Function getOpenFile$(lpstrTitle$,lpstrInitialDir$,lpstrFilter$,flags=$1000)
	
	nextOffset%=0
	theBank=CreateBank(76)
	lStructSize=76
	PokeInt theBank,nextOffset%,lStructSize
	nextOffset%=nextOffset%+4
	
	hwndOwner=0
	PokeInt theBank,nextOffset%,hwndOwner
	nextOffset%=nextOffset%+4
	
	hInstance=0
	PokeInt theBank,nextOffset%,hInstance
	nextOffset%=nextOffset%+4
	
	If lpstrFilter$ = "" Then
		lpstrFilter$ = "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)+ Chr$(0)
	Else   
		lpstrFilter$ = lpstrFilter$ + Chr$(0)      
	End If
	lpstrFilter_ = CreateBank(Len(lpstrFilter$))
	string_in_bank(lpstrFilter$,lpstrFilter_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFilter_)
	nextOffset%=nextOffset%+4
	
	lpstrCustomFilter=0
	PokeInt theBank,nextOffset%,lpstrCustomFilter
	nextOffset%=nextOffset%+4
	
	nMaxCustFilter=0
	PokeInt theBank,nextOffset%,nMaxCustFilter
	nextOffset%=nextOffset%+4
	
	nFilterIndex=0
	PokeInt theBank,nextOffset%,nFilterIndex
	nextOffset%=nextOffset%+4
	
	lpstrFile$= String$ (" ", 254)
	lpstrFile_ = CreateBank(Len(lpstrFile$))
	string_in_bank(lpstrFile$,lpstrFile_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFile_)
	nextOffset%=nextOffset%+4
	
	nMaxFile=255
	PokeInt theBank,nextOffset%,nMaxFile
	nextOffset%=nextOffset%+4
	
	lpstrFileTitle$=String$ (" ", 254)
	lpstrFileTitle_ = CreateBank(Len(lpstrFileTitle$))
	string_in_bank(lpstrFileTitle$,lpstrFileTitle_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFileTitle_)
	nextOffset%=nextOffset%+4 
	
	nMaxFileTitle=255
	PokeInt theBank,nextOffset%,nMaxFileTitle
	nextOffset%=nextOffset%+4
	
	If lpstrInitialDir$="" Then
		lpstrInitialDir$="c:\"+Chr$(0)
	Else
		lpstrInitialDir$=lpstrInitialDir$+Chr$(0)
	End If
	lpstrInitialDir_ = CreateBank(Len(lpstrInitialDir$))
	string_in_bank(lpstrInitialDir$,lpstrInitialDir_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrInitialDir_)
	nextOffset%=nextOffset%+4
	
	If lpstrTitle$="" Then
		lpstrTitle$="Open"+Chr$(0)
	Else
		lpstrTitle$ = lpstrTitle$ + Chr$(0)
	End If   
	lpstrTitle_ = CreateBank(Len(lpstrTitle$))
	string_in_bank(lpstrTitle$,lpstrTitle_)   
	PokeInt theBank,nextOffset%,AddressOf(lpstrTitle_)
	nextOffset%=nextOffset%+4
	
	PokeInt theBank,nextOffset%,flags
	nextOffset%=nextOffset%+4
	
	nFileOffset=0
	PokeShort theBank,nextOffset%,nFileOffset
	nextOffset%=nextOffset%+2
	
	nFileExtension=0
	PokeShort theBank,nextOffset%,nFileExtension
	nextOffset%=nextOffset%+2
	
	lpstrDefExt=0
	PokeInt theBank,nextOffset%,lpstrDefExt
	nextOffset%=nextOffset%+4
	
	lCustData=0
	PokeInt theBank,nextOffset%,lCustData
	nextOffset%=nextOffset%+4
	
	lpfnHook=0
	PokeInt theBank,nextOffset%,lpfnHook
	nextOffset%=nextOffset%+4
	
	lpTemplateName$=""+Chr$(0)
	lpTemplateName_ = CreateBank(Len(lpTemplateName$))
	string_in_bank(lpTemplateName$,lpTemplateName_)
	PokeInt theBank,nextOffset%,AddressOf(lpTemplateName_)
	nextOffset%=nextOffset%+4
	If api_GetOpenFileName (theBank) Then
		lpstrFile$ = bank_in_string$(lpstrFile_)
	Else
		lpstrFile$ =""
	End If
	FreeBank theBank
	FreeBank lpstrFilter_
	FreeBank lpstrFile_
	FreeBank lpstrFileTitle_
	FreeBank lpstrInitialDir_
	FreeBank lpstrTitle_
	FreeBank lpTemplateName_
	Return lpstrFile$
End Function

Function getsaveFile$(lpstrTitle$,lpstrFile$,lpstrFilter$,flags=2) ; Get a SAVEFILENAME
	
	nextOffset%=0
	theBank=CreateBank(76)
	lStructSize=76
	PokeInt theBank,nextOffset%,lStructSize
	nextOffset%=nextOffset%+4
	
	hwndOwner=0
	PokeInt theBank,nextOffset%,hwndOwner
	nextOffset%=nextOffset%+4
	
	hInstance=0
	PokeInt theBank,nextOffset%,hInstance
	nextOffset%=nextOffset%+4
	
	If lpstrFilter$ = "" Then
		lpstrFilter$ = "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)+ Chr$(0)
	Else   
		lpstrFilter$ = lpstrFilter$ + Chr$(0)      
	End If
	lpstrFilter_ = CreateBank(Len(lpstrFilter$))
	string_in_bank(lpstrFilter$,lpstrFilter_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFilter_)
	nextOffset%=nextOffset%+4
	
	lpstrCustomFilter=0
	PokeInt theBank,nextOffset%,lpstrCustomFilter
	nextOffset%=nextOffset%+4
	
	nMaxCustFilter=0
	PokeInt theBank,nextOffset%,nMaxCustFilter
	nextOffset%=nextOffset%+4
	
	nFilterIndex=0
	PokeInt theBank,nextOffset%,nFilterIndex
	nextOffset%=nextOffset%+4
	
	lpstrFile_ = CreateBank(255)
	string_in_bank(lpstrFile$+Chr$(0),lpstrFile_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFile_)
	nextOffset%=nextOffset%+4
	
	nMaxFile=255
	PokeInt theBank,nextOffset%,nMaxFile
	nextOffset%=nextOffset%+4
	
	lpstrFileTitle$=String$ (" ", 254)
	lpstrFileTitle_ = CreateBank(Len(lpstrFileTitle$))
	string_in_bank(lpstrFileTitle$,lpstrFileTitle_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFileTitle_)
	nextOffset%=nextOffset%+4 
	
	nMaxFileTitle=255
	PokeInt theBank,nextOffset%,nMaxFileTitle
	nextOffset%=nextOffset%+4
	
	lpstrInitialDir$=""+Chr$(0)
	lpstrInitialDir_ = CreateBank(Len(lpstrInitialDir$))
	string_in_bank(lpstrInitialDir$,lpstrInitialDir_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrInitialDir_)
	nextOffset%=nextOffset%+4
	
	If lpstrTitle$="" Then
		lpstrTitle$="Save"+Chr$(0)
	Else
		lpstrTitle$ = lpstrTitle$ + Chr$(0)
	End If   
	lpstrTitle_ = CreateBank(Len(lpstrTitle$))
	string_in_bank(lpstrTitle$,lpstrTitle_)   
	PokeInt theBank,nextOffset%,AddressOf(lpstrTitle_)
	nextOffset%=nextOffset%+4
	
	PokeInt theBank,nextOffset%,flags
	nextOffset%=nextOffset%+4
	
	nFileOffset=0
	PokeShort theBank,nextOffset%,nFileOffset
	nextOffset%=nextOffset%+2
	
	nFileExtension=0
	PokeShort theBank,nextOffset%,nFileExtension
	nextOffset%=nextOffset%+2
	
	lpstrDefExt=0
	PokeInt theBank,nextOffset%,lpstrDefExt
	nextOffset%=nextOffset%+4
	
	lCustData=0
	PokeInt theBank,nextOffset%,lCustData
	nextOffset%=nextOffset%+4
	
	lpfnHook=0
	PokeInt theBank,nextOffset%,lpfnHook
	nextOffset%=nextOffset%+4
	
	lpTemplateName$=""+Chr$(0)
	lpTemplateName_ = CreateBank(Len(lpTemplateName$))
	string_in_bank(lpTemplateName$,lpTemplateName_)
	PokeInt theBank,nextOffset%,AddressOf(lpTemplateName_)
	
	If api_GetSaveFileName (theBank) Then
		lpstrFile$ = bank_in_string$(lpstrFile_)
	Else
		lpstrFile$ =""
	End If
	FreeBank theBank
	FreeBank lpstrFilter_
	FreeBank lpstrFile_
	FreeBank lpstrFileTitle_
	FreeBank lpstrInitialDir_
	FreeBank lpstrTitle_
	FreeBank lpTemplateName_
	Return lpstrFile$
End Function

Function AddressOf(Bank) ; Find the correct Adress of a Bank (for C *Pointer)
	Local Address = CreateBank(4)
	api_RtlMoveMemory(Address,Bank+4,4)
	Return PeekInt(Address,0)
End Function

Function string_in_bank(s$,bankhandle) ; Put a String in a Bank
	Local pos=1
	Local pos2=0
	Repeat
		PokeByte(bankhandle,pos2,Asc(Mid(s$,pos,Len(s$))))
		pos=pos+1
		pos2=pos2+1
	Until pos=Len(s$)+1
End Function

Function bank_in_string$(bankhandle) ; Get a String from a Bank
	Local s$=""
	Local pos=0
	Repeat
		s$=s$+Chr(PeekByte(bankhandle,pos))
		pos=pos+1
	Until pos=BankSize(bankhandle)
	s$=Replace$(s$,Chr(0)," ")
	Return s$
End Function 
;~IDEal Editor Parameters:
;~C#Blitz3D